home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / include / libpurple / dbus-bindings.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-04  |  3.5 KB  |  114 lines

  1. /**
  2.  * @file dbus-bindings.h Purple DBUS Bindings
  3.  * @ingroup core
  4.  *
  5.  * purple
  6.  *
  7.  * Purple is the legal property of its developers, whose names are too numerous
  8.  * to list here.  Please refer to the COPYRIGHT file distributed with this
  9.  * source distribution.
  10.  *
  11.  * This program is free software; you can redistribute it and/or modify
  12.  * it under the terms of the GNU General Public License as published by
  13.  * the Free Software Foundation; either version 2 of the License, or
  14.  * (at your option) any later version.
  15.  *
  16.  * This program is distributed in the hope that it will be useful,
  17.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19.  * GNU General Public License for more details.
  20.  *
  21.  * You should have received a copy of the GNU General Public License
  22.  * along with this program; if not, write to the Free Software
  23.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  24.  *
  25.  */
  26.  
  27. #ifndef _PURPLE_DBUS_BINDINGS_H_
  28. #define _PURPLE_DBUS_BINDINGS_H_
  29.  
  30. #include <dbus/dbus.h>
  31. #include <dbus/dbus-glib-lowlevel.h>
  32. #include <glib.h>
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. gint purple_dbus_pointer_to_id(gpointer node);
  39. gpointer purple_dbus_id_to_pointer(gint id, PurpleDBusType *type);
  40. gint  purple_dbus_pointer_to_id_error(gpointer ptr, DBusError *error);
  41. gpointer purple_dbus_id_to_pointer_error(gint id, PurpleDBusType *type,
  42.                        const char *typename, DBusError *error);
  43.  
  44. #define NULLIFY(id) id = empty_to_null(id)
  45.  
  46. #define CHECK_ERROR(error) if (dbus_error_is_set(error)) return NULL;
  47.  
  48. #define PURPLE_DBUS_ID_TO_POINTER(ptr, id, type, error)            \
  49.     G_STMT_START {                            \
  50.     ptr = (type*) purple_dbus_id_to_pointer_error            \
  51.         (id, PURPLE_DBUS_TYPE(type), #type, error);            \
  52.     CHECK_ERROR(error);                        \
  53.     } G_STMT_END
  54.  
  55.  
  56. #define PURPLE_DBUS_POINTER_TO_ID(id, ptr, error)                \
  57.     G_STMT_START {                            \
  58.     id = purple_dbus_pointer_to_id_error(ptr,error);            \
  59.     CHECK_ERROR(error);                        \
  60.     } G_STMT_END
  61.  
  62.  
  63. dbus_bool_t
  64. purple_dbus_message_get_args (DBusMessage     *message,
  65.                 DBusError       *error,
  66.                 int              first_arg_type,
  67.                 ...);
  68. dbus_bool_t
  69. purple_dbus_message_get_args_valist (DBusMessage     *message,
  70.                    DBusError       *error,
  71.                    int              first_arg_type,
  72.                    va_list          var_args);
  73.  
  74. dbus_bool_t
  75. purple_dbus_message_iter_get_args (DBusMessageIter *iter,
  76.                  DBusError       *error,
  77.                  int              first_arg_type,
  78.                  ...);
  79.  
  80. dbus_bool_t
  81. purple_dbus_message_iter_get_args_valist (DBusMessageIter *iter,
  82.                     DBusError       *error,
  83.                     int              first_arg_type,
  84.                     va_list          var_args);
  85.  
  86. dbus_int32_t* purple_dbusify_GList(GList *list, gboolean free_memory, 
  87.                  dbus_int32_t *len);
  88. dbus_int32_t* purple_dbusify_GSList(GSList *list, gboolean free_memory,
  89.                   dbus_int32_t *len);
  90. gpointer* purple_GList_to_array(GList *list, gboolean free_memory,
  91.                   dbus_int32_t *len);
  92. gpointer* purple_GSList_to_array(GSList *list, gboolean free_memory,
  93.                   dbus_int32_t *len);
  94. GHashTable *purple_dbus_iter_hash_table(DBusMessageIter *iter, DBusError *error);
  95.  
  96. const char* empty_to_null(const char *str);
  97. const char* null_to_empty(const char *s);
  98.  
  99. typedef struct {
  100.     const char *name;
  101.     const char *parameters;
  102.     DBusMessage* (*handler)(DBusMessage *request, DBusError *error);
  103. } PurpleDBusBinding;
  104.  
  105. void purple_dbus_register_bindings(void *handle, PurpleDBusBinding *bindings);
  106.  
  107. DBusConnection *purple_dbus_get_connection(void);
  108.  
  109. #ifdef __cplusplus
  110. }
  111. #endif
  112.  
  113. #endif
  114.